package com.changgou.filter;

/****
 * 判断访问的请求是否需要登录，不需要登录的则返回true直接放行
 */
public class URLFilter {

    public static String filterPath = "/api/cart/**,/api/categoryReport/**,/api/orderConfig/**," +
            "/api/order/**,/api/orderItem/**,/api/orderLog/**,/api/preferential/**,/api/returnCause/**," +
            "/api/returnOrder/**,/api/returnOrderItem/**,/api/user/**,/api/address/**,/api/areas/**," +
            "/api/cities/**,/api/provinces/**,/api/cart/**,/api/categoryReport/**,/api/orderConfig/**," +
            "/api/order/**,/api/orderItem/**,/api/orderLog/**,/api/preferential/**,/api/returnCause/**," +
            "/api/returnOrder/**,/api/returnOrderItem/**,/api/seckillOrder/**,/api/collect/addCollect/**," +
            "/api/collect/search/**,/api/trace/search/**,/api/comment/add/**";

    public static boolean noAuthorize(String uri) {
        String[] split = filterPath.replace("/**", "").split(",");
        for (String filterPath : split) {
            if (uri.startsWith(filterPath)) {
                return false;
            }
        }
        return true;
    }
}
